	<template>
		<view class="container">
		<!-- 		<button class="affair" type="primary" @tap="affair">河南政务服务网</button>
		<button class="housing" type="primary" @tap="housing">河南省住房和城乡建设厅</button>
		<button class="credit" type="primary" @tap="credit">信用中国</button>
		<button class="believe" type="primary" @tap="believe">学信网</button>
		<button class="security" type="primary" @tap="security">社保查询网</button>
		<button class="constructor" type="primary" @tap="constructor">建造师证查询网</button>
		<button class="build" type="primary" @tap="build">郑州住建网</button> -->
		<button v-for="(item, index) in urlList" :class="'button'+(index%7+1)" type="primary"
			:data-url="item.detail" :data-name="item.name"  :key="item.id"
			v-text="item.name" @tap="tapButtonItem">
		</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			commsiteUrl: 'https://www.1xx.online/japx/commwebsite',
			urlList: []
		};
	},
	onLoad() {
		this.getUrlList();
	},
	methods: {
		getUrlList() {
			var that = this;
			uni.request({
				url: that.commsiteUrl,
				data: JSON.stringify({ params: { status: 'active' }, jsonrpc: '2.0', id: Number(new Date()) }),
				header: {
					'Content-Type': 'application/json'
				},
				method: 'POST',
				dataType: 'json',
				complete: res => {
					if (res.statusCode == 200) {
						var result = res.data.result;
						if (!!result) {
							that.urlList = [];
							for (var i = 0; i < result.data.length; i++) {
								that.urlList.push(result.data[i]);
							}
						}
					}
				}
			});
		},
		tapButtonItem(e){
			console.log(e.currentTarget.dataset['url']);
			var url = e.currentTarget.dataset['url'];
			var name = e.currentTarget.dataset["name"]
			uni.navigateTo({
				url: '/pages/comm/webview?url='+url.replace('https://','').replace('http://',''),
				text:name
			});
			
		},
		affair() {
			uni.navigateTo({
				url: '/pages/comm/webview?url=www.hnzwfw.gov.cn'
			});
		},
		housing() {
			uni.navigateTo({
				url: '/pages/comm/webview?url=hnjs.gov.cn'
			});
		},
		credit() {
			uni.navigateTo({
				url: '/pages/comm/webview?url=www.creditchina.gov.cn'
			});
		},
		believe() {
			uni.navigateTo({
				url: '/pages/comm/webview?url=www.chsi.com.cn'
			});
		},
		security() {
			uni.navigateTo({
				url: '/pages/comm/webview?url=www.12333sb.com'
			});
		},
		constructor() {
			uni.navigateTo({
				url: '/pages/comm/webview?url=www.coc.gov.cn/coc/webview/regConstructor.jspx'
			});
		},
		build() {
			uni.navigateTo({
				url: '/pages/comm/webview?url=zzjsj.zhengzhou.gov.cn/'
			});
		}
	}
};
</script>

<style>
.container {
	padding: 40upx 20upx;
}
button {
	margin: 30upx 10upx;
	font-size: 30upx;
	padding: 10upx 0;
}
.button1 {
	background-color: #24c68a !important;
}
.button2 {
	background-color: #7d96fb !important;
}
.butto3 {
	background-color: #b292ff !important;
}
.button4 {
	background-color: #24c68a !important;
}
.button5 {
	background-color: #b292ff !important;
}
.button6 {
	background-color: #7d96fb !important;
}
.button7 {
	background-color: #ff9597 !important;
}
</style>
